package br.com.virtual.base.controller.photo;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;

import br.com.virtual.cadastrar.model.Foto;
import br.com.virtual.cadastrar.service.PhotoManagerService;

@ManagedBean(eager = true)
@ApplicationScoped
public class photoManagerMB {

	private boolean start;

	@EJB
	PhotoManagerService photoManagerService;

	@PostConstruct
	public void init() {

		this.start = true;
		List<Foto> photos = this.photoManagerService.fotosToWrite();
		this.photoManagerService.addPhotosToTemporaryDirectory(photos);
		photos = null;
		this.start = false;

	}

	public boolean isStart() {
		return start;
	}

	public void setStart(boolean start) {
		this.start = start;
	}

}
